package com.my.app.tools.ui.awt;

import com.my.app.tools.pojo.AppConstants;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * 显示启动画面
 *
 * @author guochaohui
 * @return
 * @date 2020-04-14 18:36
 */
public class SplashScreenWindow extends JWindow {

    public SplashScreenWindow() {
        BufferedImage image = AppConstants.getAppIcon();
        int width = image.getWidth();
        int height = image.getHeight() + 30;

        JLabel label = new JLabel("程序启动中......", new ImageIcon(image), SwingConstants.LEADING);
        label.setSize(width, height);
        label.setVerticalTextPosition(SwingConstants.BOTTOM);
        label.setHorizontalTextPosition(SwingConstants.CENTER);
        label.setFont(new Font(null, Font.BOLD, 25));
        this.add(label);

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
        this.setLayout(new GridLayout(1, 1));
        this.setSize(width, height);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }

}
